package edu.washington.ling.syntric.config;

import org.apache.commons.configuration.XMLConfiguration;

public class Configuration {
	private String[] depFeats;
	private String[] headFeats;
	private boolean useExtPOS;
	private boolean extractOrder;
	
	private Configuration(String[] depFeats, String[] headFeats, boolean useExtPOS, boolean extractOrder) {
		this.depFeats = depFeats;
		this.headFeats = headFeats;
		this.useExtPOS = useExtPOS;
		this.extractOrder = extractOrder;
	}
	
	public static Configuration initDefault() {
		String[] depFeats = new String[] {"reltype", "ectype", "scr-long", 
				"scr-arg", "scr-mod", "extr"};
		String[] headFeats = new String[] {"ectype"};
		boolean useExtPOS = true;
		boolean extractOrder = true;
		return new Configuration(depFeats, headFeats, useExtPOS, extractOrder);
	}
	
	public static Configuration init(XMLConfiguration config) {
		String[] depFeats = config.getStringArray("dep-feats.feat");
		String[] headFeats = config.getStringArray("head-feats.feat");
		boolean useExtPOS = config.getBoolean("use-ext-pos");
		boolean extractOrder = config.getBoolean("extract-order");
		return new Configuration(depFeats, headFeats, useExtPOS, extractOrder);
	}
	public String[] getDepFeats() {
		return depFeats;
	}
	public String[] getHeadFeats() {
		return headFeats;
	}
	public boolean useExtPOS() {
		return useExtPOS;
	}
	public boolean extractOrder() {
		return extractOrder;
	}
}